/* 将日期毫秒数转换成String类型的yyyy-MM-dd hh:mm型日期格式 */
function formatDateTime(inputTime) {    
    var date = new Date(inputTime);  
    var y = date.getFullYear();    
    var m = date.getMonth() + 1;    
    m = m < 10 ? ('0' + m) : m;    
    var d = date.getDate();    
    d = d < 10 ? ('0' + d) : d;    
    var h = date.getHours();  
    h = h < 10 ? ('0' + h) : h;  
    var minute = date.getMinutes();  
    var second = date.getSeconds();  
    minute = minute < 10 ? ('0' + minute) : minute;    
    second = second < 10 ? ('0' + second) : second;   
    return y + '-' + m + '-' + d +" "+h+":"+minute;    
};
/* 将日期毫秒数转换成String类型的yyyy-MM-dd hh:mm:ss型日期格式 */
function formatDateTimeYMDHMS(inputTime) {
    var date = new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d +" "+h+":"+minute+":"+second;
};
/* 将日期毫秒数转换成String类型的yyyy-MM-dd型日期格式 */
function formatshortDateTime(inputTime) {
    var date = new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d;
};
/* 将日期毫秒数转换成String类型的yyyy年MM月dd日 hh时mm分型日期格式 */
function formatDateChineseTime(chineTime) {    
    var date = new Date(chineTime);  
    var y = date.getFullYear();    
    var m = date.getMonth() + 1;    
    m = m < 10 ? ('0' + m) : m;    
    var d = date.getDate();    
    d = d < 10 ? ('0' + d) : d;    
    var h = date.getHours();  
    h = h < 10 ? ('0' + h) : h;  
    var minute = date.getMinutes();  
    var second = date.getSeconds();  
    minute = minute < 10 ? ('0' + minute) : minute;    
    second = second < 10 ? ('0' + second) : second;   
    return y + '年' + m + '月' + d +"日  "+h+"时"+minute+"分";    
}; 

/* 将日期毫秒数转换成String类型的yyyy年MM月dd日 型日期格式 */
function ChineseTimeYMD(chineTime) {    
    var date = new Date(chineTime);  
    var y = date.getFullYear();    
    var m = date.getMonth() + 1;    
    m = m < 10 ? ('0' + m) : m;    
    var d = date.getDate();    
    d = d < 10 ? ('0' + d) : d;    
    var h = date.getHours();  
    h = h < 10 ? ('0' + h) : h;  
    var minute = date.getMinutes();  
    var second = date.getSeconds();  
    minute = minute < 10 ? ('0' + minute) : minute;    
    second = second < 10 ? ('0' + second) : second;   
    return y + '年' + m + '月' + d +"日  ";    
};

/*将字符串转换为时间*/
function strToDate(str){
    var end_str = str.replace(/-/g,"/");
    var end_date = new Date(end_str);
    return end_date;
}

//BootStrap日期
function bootStrapDate(id){
    var idr="#"+id;
    $(idr).datepicker({
        autoclose: true,
        language: 'zh-CN',//显示中文
        format: 'yyyy-mm-dd',//显示格式
        locale: moment.locale('zh-cn'),
        endDate: new Date()
    });
}